using I2.Loc;

public class MarketArmorInfoPanel : MarketProductInfoPanel
{
	public UILabel armorCount;

	public UILabel armorCountADD;

	public UISprite damageTypeSprite;

	public UILabel damageTypeLabel;

	public UILabel damageTypePercentLabel;

	public UISprite rareTypeSprite;

	public UILabel rareTypeLabel;

	public override void SetInfo(Product product, bool setUpgrades, bool needComparison = true)
	{
		currentProduct = product;
		base.SetInfo(product, setUpgrades);
		ProductArmor productArmor = (ProductArmor)product;
		ProductArmor productArmor2 = ((!needComparison) ? product : MarketControllerUI.instance.selectedProduct) as ProductArmor;
		if (productArmor2 == productArmor)
		{
			armorCount.text = productArmor.bonusHP.ToString();
			if ((bool)armorCountADD)
			{
				armorCountADD.text = string.Empty;
			}
		}
		else
		{
			armorCount.text = productArmor2.bonusHP.ToString();
			if ((bool)armorCountADD)
			{
				armorCountADD.text = CompareParametrs(productArmor.bonusHP, productArmor2.bonusHP, "F0");
			}
		}
		if (productArmor.protection != 0 && productArmor.protectionPercent > 0f)
		{
			if ((bool)damageTypeSprite)
			{
				damageTypeSprite.spriteName = "DamageType_" + productArmor.protection;
			}
			if ((bool)damageTypeLabel)
			{
				damageTypeLabel.text = productArmor.protection.ToString();
			}
			if ((bool)damageTypePercentLabel)
			{
				damageTypePercentLabel.text = productArmor.protectionPercent + "%";
			}
		}
		else
		{
			if ((bool)damageTypeSprite)
			{
				damageTypeSprite.spriteName = string.Empty;
			}
			if ((bool)damageTypeLabel)
			{
				damageTypeLabel.text = string.Empty;
			}
			if ((bool)damageTypePercentLabel)
			{
				damageTypePercentLabel.text = string.Empty;
			}
		}
		rareTypeSprite.spriteName = "RareType_" + productArmor.rare;
		rareTypeLabel.text = ScriptLocalization.Get("Market/RareType_" + productArmor.rare);
		SetTitleLocalization();
		SetDescriptionLocalization();
		if (setUpgrades)
		{
			SetUpgrades();
		}
		else
		{
			SelectUpgradeButton();
		}
	}
}
